public class Manage {
    private static final Manage INSTANCE = new Manage();
    private static int id = 0;

    private Manage() {
        id++;
    };

    public static Manage getInstance() {return INSTANCE;}

    @Override
    public String toString() {
        return "id=" + id;
    }

    public static void main(String[] args) {
        Manage m1 = getInstance();
        Manage m2 = getInstance();
        System.out.println(m1 == m2); // 始终为真，内存只有一个实例
    }
}
